//
//  DefaultURLHandler.m
//  ITV
//
//  Created by inphase on 2017/8/2.
//  Copyright © 2017年 inphase. All rights reserved.
//

#import "DefaultURLHandler.h"

#import "HTTPClientConfig.h"


@implementation DefaultURLHandler

-(NSString *)fullURLWithKey:(NSString *)key {

    NSString *url = [[HTTPClientConfig sharedHTTPClientConfig] urlWithKey:key];
    // 处理URL
    if (![self isURL:url]) {
        NSString *host = [[HTTPClientConfig sharedHTTPClientConfig] hostURL];
        NSString *returnURL = [NSString stringWithFormat:@"%@/%@",host,url];
        return returnURL;
    }
    return url;
}


-(BOOL) isURL:(NSString *) url {

    if (![url hasPrefix:@"http://"] && ![url hasPrefix:@"https://"]) {
        return NO;
    }
    return YES;
}

@end
